/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hlavneMenu;

import editorRozpisu.ZobrazRozpis;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.Calendar;
import javax.swing.JFrame;
import spravaSviatkov.SpravaSviatkov;
import spravaZamestnancov.SpravaZamestnancov;

/**
 *
 * @author Monika
 */
public class HlavneMenu extends javax.swing.JFrame {

    /**
     * Creates new form HlavneMenu
     */
    public HlavneMenu() {
        initComponents();
    
        //centralizovanie okna
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        int X = (screen.width / 2) - (this.getWidth() / 2); // Center horizontally.
        int Y = (screen.height / 2) - (this.getHeight() / 2); // Center vertically.
        this.setLocation(X, Y);

        for (int i = 1; i <= 12; i++) {
            mesiacCB.addItem(i);
        }
        mesiacCB.setSelectedItem(Calendar.getInstance().get(Calendar.MONTH) + 1);
        for (int i = 2012; i <= Calendar.getInstance().get(Calendar.YEAR) + 1; i++) {
            rokCB.addItem(i);
        }
        rokCB.setSelectedItem(Calendar.getInstance().get(Calendar.YEAR));

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        zamButton = new javax.swing.JButton();
        rozpisButton = new javax.swing.JButton();
        sviatkyButton = new javax.swing.JButton();
        rokCB = new javax.swing.JComboBox();
        mesiacCB = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Hlavné menu");

        zamButton.setText("Spravovať zamestnancov");
        zamButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                zamButtonActionPerformed(evt);
            }
        });

        rozpisButton.setText("Spravovať rozpis");
        rozpisButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rozpisButtonActionPerformed(evt);
            }
        });

        sviatkyButton.setText("Spravovať sviatky");
        sviatkyButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sviatkyButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(mesiacCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rokCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(zamButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(sviatkyButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(rozpisButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(rozpisButton)
                    .addComponent(rokCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mesiacCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(34, 34, 34)
                .addComponent(zamButton)
                .addGap(30, 30, 30)
                .addComponent(sviatkyButton)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(66, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(43, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void rozpisButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rozpisButtonActionPerformed

        // otvori nove okno s rozpisom
        ZobrazRozpis zr = new ZobrazRozpis((Integer) mesiacCB.getSelectedItem(), (Integer) rokCB.getSelectedItem());
        zr.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        zr.setVisible(true);
    }//GEN-LAST:event_rozpisButtonActionPerformed

    private void zamButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zamButtonActionPerformed
        // otvori nove okno na spravu zamestnancov
        SpravaZamestnancov sz = new SpravaZamestnancov();
        sz.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        sz.setVisible(true);
    }//GEN-LAST:event_zamButtonActionPerformed

    private void sviatkyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sviatkyButtonActionPerformed
        // otvori nove okno na spravu sviatkov
        SpravaSviatkov ss = new SpravaSviatkov();
        ss.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        ss.setVisible(true);
    }//GEN-LAST:event_sviatkyButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(HlavneMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(HlavneMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(HlavneMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(HlavneMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new HlavneMenu().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JComboBox mesiacCB;
    private javax.swing.JComboBox rokCB;
    private javax.swing.JButton rozpisButton;
    private javax.swing.JButton sviatkyButton;
    private javax.swing.JButton zamButton;
    // End of variables declaration//GEN-END:variables
}
